

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import eu.hansolo.steelseries.gauges.Radial;
import eu.hansolo.steelseries.gauges.SparkLine;

//import eu.hansolo.steelseries.;
import java.awt.BorderLayout;
import java.awt.Color;

import javax.swing.JPanel;

/**
 * This code was edited or generated using CloudGarden's Jigloo
 * SWT/Swing GUI Builder, which is free for non-commercial
 * use. If Jigloo is being used commercially (ie, by a corporation,
 * company or business for any purpose whatever) then you
 * should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details.
 * Use of Jigloo implies acceptance of these licensing terms.
 * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
 * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
 * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class Display2 extends javax.swing.JFrame {
	private JPanel jPanel1;
	private SparkLine sparkLine1;
	//	private double dd;

	Radial instSOG = new Radial();
	Radial instAWS = new Radial();
	Radial instTWS = new Radial();

	/**
	 * Auto-generated main method to display this JFrame
	 */
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run(){
				Display2 inst = new Display2();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
				inst.setWerte(6.9,15.0,17.2);
			}
		});
	}

	public Display2(){
		super();
		initGUI();
	}

	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				jPanel1 = new JPanel();
				getContentPane().add(jPanel1, BorderLayout.CENTER);

			}
			pack();
			this.setSize(1024,600);

			instSOG.setMinValue(0.0);
			instSOG.setMaxValue(10.0);
			instSOG.setValueCoupled(false);
			instSOG.setLcdDecimals(1);
			instSOG.setLcdUnitString("ktn");
			instSOG.setLcdUnitStringVisible(true);
			instSOG.setTitle("SOG");
			instSOG.setUnitString("ktn");			
			instSOG.setMaxMeasuredValueVisible(true);
			instSOG.setMinMeasuredValueVisible(true);
			instSOG.setScaleDividerPower(0);

			instSOG.setThreshold(7.0);
			instSOG.setThresholdVisible(true);

			instAWS.setMinValue(0.0);
			instAWS.setMaxValue(30.0);
			instAWS.setValueCoupled(false);
			instAWS.setLcdDecimals(1);
			instAWS.setTitle("AWS");
			instAWS.setUnitString("ktn");

			instTWS.setMinValue(0.0);
			instTWS.setMaxValue(30.0);
			instTWS.setValueCoupled(false);
			instTWS.setLcdDecimals(1);
			instTWS.setTitle("TWS");
			instTWS.setUnitString("ktn");
			instTWS.setTrackStart(10);
			instTWS.setTrackSection(20);
			instTWS.setTrackStop(30);
			//instTWS.setTrackStartColor(new Color(100));
			instTWS.setTrackVisible(true);


			instSOG.setPreferredSize(new java.awt.Dimension(250, 250));
			instAWS.setPreferredSize(new java.awt.Dimension(250, 250));
			instTWS.setPreferredSize(new java.awt.Dimension(250, 250));

			jPanel1.add(instSOG);
			jPanel1.add(instAWS);
			jPanel1.add(instTWS);
			{
				sparkLine1 = new SparkLine();
				jPanel1.add(sparkLine1);
				sparkLine1.setHiLoIndicatorVisible(true);
				sparkLine1.setBaseLineVisible(true);
				sparkLine1.setPreferredSize(new java.awt.Dimension(500, 100));
				sparkLine1.setAverageVisible(true);
				sparkLine1.setSparkLineColor(eu.hansolo.steelseries.tools.LcdColor.GRAY_LCD);
				sparkLine1.setTimeFrame(600000);
				sparkLine1.setInfoLabelsVisible(true);
			}
			
			//sparkLine1.setStartStopIndicatorVisible(true);

		} catch (Exception e) {
			//add your error handling code here
			e.printStackTrace();
		}
	}

	public void setWerte (double f, Double g, Double h){
		Double sog = f;
		Double tws = g;
		Double aws = h;
		instSOG.setValueAnimated(sog);
		instSOG.setLcdValue(sog);
		instAWS.setValueAnimated(aws);
		instAWS.setLcdValue(aws);
		instTWS.setValueAnimated(tws);
		instTWS.setLcdValue(tws);
		sparkLine1.addDataPoint(sog);
		System.out.println("Value set to  : "+sparkLine1.getLo());
	}
}

